import axios from 'axios'
import router from '@/router'
var actions={
	login({commit},username,password){
		axios({
			// url:'http://10.8.158.36:8080/UserLogin.do',
			url:'http://jx.xuzhixiang.top/ap/api/login.php',
			params:{username:username,password:password}
		}).then((res)=>{
			console.log(res)
			if(res.data.code==1){
				alert(res.data.msg)
				commit('login',username)
				// console.log(res.data.data)
				// localStorage.setItem('token',res.data.data.id)
				// 
				// localStorage.setItem('username',res.data.data.username)
				
				// console.log(res.data.data.id)
				router.push('/home')
			}
		})
	}
	
}

export default actions;